package com.company.test29;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by v on 16-11-25.
 */
public class Test2906 {
    static class PrintChar implements Runnable{
        private char ch;
        private int number;
        public PrintChar(char ch,int number){
            this.ch=ch;
            this.number=number;
        }

        @Override
        public void run() {
            for(int i=0;i<number;i++){
                System.out.print(ch);
            }
        }
    }

    static class PrintNumber implements Runnable{
        private int number;

        public PrintNumber(int number){
            this.number=number;
        }

        @Override
        public void run() {
            for(int i=0;i<number;i++){
                System.out.print(i);
            }
        }
    }

    public static void main(String[] args) {
        PrintChar printa=new PrintChar('a',100);
        PrintChar printb=new PrintChar('b',100);
        PrintNumber printNumber=new PrintNumber(100);

        ExecutorService executor= Executors.newFixedThreadPool(3);

        executor.execute(printa);
        executor.execute(printb);
        executor.execute(printNumber);

        executor.shutdown();
    }
}
